#ifndef LIGHT_H
#define LIGHT_H

#include <GL/gl.h>

#include "src/defines/light.h"

#include "src/math/vector3d.h"

#include "src/scene/photon.h"
#include "src/scene/color.h"
#include "src/scene/nearestInfo.h"
//#include "src/scene/projectionMap.h"

class Object;
class HBBTree;

class Light{
	public:
		Light();
		Light(unsigned int _id, const Color &, double = 1);
		virtual ~Light();

		int getId() const {return id;};

		void select(bool _b = true) {selected = _b;};

		const Color &getColor() const {return color;};
		void setColor(const Color &_c) {color = _c;};

		double getEnergy() const {return energy;};
		void setEnergy(double _e) {energy = _e;};

//		virtual const Vector3D &getPosition() const{};

//        virtual void calculateProjectionMap(HBBTree *) {};
        virtual void generatePhotonPointDirection(Vector3D *, Vector3D *, Object *) const {};

        virtual unsigned int getType() const = 0;
        virtual Color getIntersectionColor(const NearestInfo &, const Vector3D &, HBBTree *, const unsigned int & = LINEAR_ATTENUATION) const = 0;
        virtual void shine(const GLenum &) = 0;
        virtual void draw() const{};

	protected:
        int id;
        Color color;
        bool selected;
        double energy;
//        ProjectionMap *projectionMap;

        double attenuation(const unsigned int &, const double &) const;
        bool isOccluded(const NearestInfo &, const Vector3D &, HBBTree *, const Vector3D &) const;
        Vector3D objectMap(const Vector3D &, Object *) const;
};

#endif
